package com.zhengxyou.jetpackdemo.daggerDemo.module;

import com.zhengxyou.jetpackdemo.daggerDemo.bean.Cloth;
import com.zhengxyou.jetpackdemo.daggerDemo.bean.Clothes;
import com.zhengxyou.jetpackdemo.daggerDemo.bean.ClothsHandle;

import javax.inject.Named;
import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;

@Module
public class MainMoudel {
    @Provides
    @Named("red")
    public Cloth getRedCloth() {
        Cloth cloth = new Cloth();
        cloth.setColor("红色");
        return cloth;
    }

    @Singleton
    @Provides
    @Named("blue")
    public Cloth getBlueCloth() {
        Cloth cloth = new Cloth();
        cloth.setColor("蓝色");
        return cloth;
    }

    @Provides
    @RedCloth
    public Cloth getBlackCloth2() {
        Cloth cloth = new Cloth();
        cloth.setColor("黑色");
        return cloth;
    }

    //    @Provides
//    public Clothes getClothes() {
//        Cloth cloth = new Cloth();
//        cloth.setColor("绿色");
//        return new Clothes(cloth);
//    }
    @Provides
    public Clothes getClothes(@Named("blue") Cloth cloth) {
        return new Clothes(cloth);
    }

//    @Provides
//    @Singleton
//    public ClothsHandle getClothHandles() {
//        return new ClothsHandle();
//    }
}
